import {Image, Swiper} from "@taroify/core"
import Taro from '@tarojs/taro'
import './index.scss'
import {View} from "@tarojs/components";

export default function BannerSwiper(props: { banners: string[] }) {
  // 跳转页面
  const handleClick = (index: number) => {
    Taro.navigateTo({
      url: '/pages/nanJIng/njAddress/index' + index
    })
  }

  return (
    <View className="swiper-container">
      <Swiper className="custom-swiper" lazyRender autoplay={4000} loop>
        <Swiper.Indicator/>
        {
          props.banners?.map((item, index) => {
            return (
              <Swiper.Item key={index} className="swiper-item" onClick={() => handleClick(0)}>
                <Image src={item} className="swiper-image" mode="aspectFill"/>
              </Swiper.Item>
            )
          })
        }
      </Swiper>
    </View>
  )
}
